<!--
 * @Description: ...
 * @Author: yangli 121029539@qq.com
 * @Date: 2025-02-06 11:23:56
 * @LastEditTime: 2025-02-13 15:16:02
 * @LastEditors: yangli 121029539@qq.com
 * @FilePath: \uniapp\src\pagesshopcenter\home.vue
-->
<template>
    <view class="bg-page min-h-screen">
        <view class="pb-[10px] page-top h-[260rpx] py-[46rpx] px-[56rpx] flex flex-row justify-between items-center">
            <view class="flex items-center flex-row">
                <image v-if="userInfo && userInfo.avatar" :src="userInfo.avatar"
                    class="w-[120rpx] h-[120rpx] rounded-full" />
                <image v-else src="/static/images/user/default_avatar.png" class="w-[120rpx] h-[120rpx] rounded-full" />
                <view class="ml-[32rpx]">
                    <view v-if="token" class="text-white text-[36rpx]">
                        {{ userInfo?.nickname || '未登录' }}
                    </view>
                    <navigator v-else class="flex items-center" hover-class="none" url="/pages/login/login">
                        <view class="text-white text-3xl ml-[20rpx]">去登录</view>
                    </navigator>
                </view>
            </view>
        </view>
        <view
            class="bg-white flex flex-row justify-center items-center py-[50rpx] px-[32rpx] border-solid border-0 border-b border-[#f5f5f5]">
            <!-- <view class="flex flex-row">
        </view> -->
            <view class="flex-1 flex-col flex items-center justify-center">
                <view class="font-extrabold mb-[32rpx] text-[50rpx]">{{ state.pageData.total_count }}</view>
                <view class="text-base">已激活</view>
            </view>
            <view class="flex-1 flex-col flex items-center  justify-center">
                <view class="font-extrabold  mb-[32rpx]  text-[50rpx]">{{ state.pageData.total_un_count }}</view>
                <view class="text-base">未激活</view>
            </view>
        </view>
        <view class="p-[32rpx] bg-white">
            <view class="">
                <u-grid :col="3" :border="false">
                    <u-grid-item @click="toPage(item.path)" :custom-style="{ padding: '0 0 32rpx 0' }"
                        v-for="(item, index) in dataList" :key="index">

                        <image :src="`/static/images/repair/business${index + 1}.png`" class="w-[52rpx] h-[52rpx] " />
                        <view class="text-main text-base mt-[14rpx]">
                            {{ item.title }}
                        </view>
                    </u-grid-item>
                </u-grid>
            </view>
        </view>
    </view>
</template>

<script setup lang="ts">

import { onLoad, onShow, onPageScroll } from "@dcloudio/uni-app";
import { computed, reactive, ref } from 'vue'
import { useAppStore } from '@/stores/app'
import { useUserStore } from '@/stores/user'
const appStore = useAppStore()
const userStore = useUserStore()
const token = computed(() => userStore.token)
const userInfo = computed(() => userStore.userInfo)
const state = reactive({
    pageData: {
        total_count: 500,
        total_un_count: 500,
    }
})
const dataList = [
    {
        title: '统计详情',
        path: '/pagesshopcenter/count'
    },
    {
        title: '提现',
        path: '/pagesshopcenter/tixian'
    }, {
        title: '佣金',
        path: '/pagesshopcenter/yongjin'
    }
]
const toPage = (path: any, type = 1) => {
    // if(!token.value) return uni.navigateTo({url:'/pages/login/login'})
    if (type == 2) {
        uni.switchTab({ url: path })
    } else {
        uni.navigateTo({ url: path })
    }
}
// 物流选择
const init = async () => {
    const data = await shopCenter()
    state.pageData = data
}


onShow(() => { })
</script>

<style lang="scss" scoped>
.page-top {
    background: url('/static/images/repair/bg.png') no-repeat 0 0;
    background-size: cover;
}
</style>
